package pack3;

import pack3.utils.Utils;

import java.util.Arrays;

public class InsertSort {

    public static void main(String[] args) {
        int []arr=new int[]{7,5,6,9,10,1,3,7,4,3,2};
        insertSort(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void insertSort(int[]arr){
        for (int i = 1; i < arr.length; i++) {
            int temp = arr[i];
            int j;
            for (j = i - 1; j >= 0; j--) {
                if (arr[j] > temp) {
                    arr[j+1]=arr[j];
                } else {
                    break;
                }
            }
            arr[j + 1] = temp;
        }
    }

}
